home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / dev / moni / SystemViewer.lha / Source / SysInterrupt.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-25  |  17.1 KB  |  717 lines

  1. /****h* SysViewer/SysInterrupt.c [1.0] *********************************
  2. *
  3. * NAME
  4. *    SysInterrupt.c
  5. *
  6. * DESCRIPTION
  7. *    Display the interrupts known in ExecBase->IntVects[].
  8. ************************************************************************
  9. *
  10. */
  11.  
  12. #include <string.h>
  13.  
  14. #include <exec/types.h>
  15. #include <exec/execbase.h>
  16.  
  17. #include <AmigaDOSErrs.h>
  18.  
  19. #include <intuition/intuition.h>
  20. #include <intuition/classes.h>
  21. #include <intuition/classusr.h>
  22. #include <intuition/gadgetclass.h>
  23.  
  24. #include <libraries/gadtools.h>
  25.  
  26. #include <graphics/displayinfo.h>
  27. #include <graphics/gfxbase.h>
  28.  
  29. #include <clib/exec_protos.h>
  30. #include <clib/intuition_protos.h>
  31. #include <clib/gadtools_protos.h>
  32. #include <clib/graphics_protos.h>
  33. #include <clib/utility_protos.h>
  34. #include <clib/diskfont_protos.h>
  35.  
  36. #include "CPGM:GlobalObjects/CommonFuncs.h"
  37.  
  38. #include "SysLists.h"
  39.  
  40. #define ILV       0
  41. #define Update    1
  42. #define Remove    2
  43. #define Priority  3
  44. #define Cancel    4
  45. #define SelectTxt 5
  46.  
  47. #define SI_CNT    6
  48.  
  49. #define INTLVGAD    SIGadgets[ ILV ]
  50. #define REMOVEGAD   SIGadgets[ Remove ]
  51. #define PRIORITYGAD SIGadgets[ Priority ]
  52. #define TEXTGAD     SIGadgets[ SelectTxt ]
  53.  
  54. IMPORT struct ExecBase *SysBase;
  55.  
  56. // --------------------------------------------------------------------
  57.  
  58. PRIVATE char ver[] = "$VER: SysInterrupts 1.0 (23-Sep-2000) by J.T. Steichen";
  59.  
  60. PRIVATE struct TextFont     *SIFont  = NULL;
  61. PRIVATE struct Window       *SIWnd   = NULL;
  62. PRIVATE struct Gadget       *SIGList = NULL;
  63. PRIVATE struct IntuiMessage  SIMsg;
  64. PRIVATE struct Gadget       *SIGadgets[ SI_CNT ];
  65.  
  66. PRIVATE UWORD  SILeft   = 0;
  67. PRIVATE UWORD  SITop    = 16;
  68. PRIVATE UWORD  SIWidth  = 632;
  69. PRIVATE UWORD  SIHeight = 320;
  70. PRIVATE UBYTE *SIWdt    = (UBYTE *) "System Interrupts Info:";
  71.  
  72. PRIVATE char ttl[] = "Address  Data     Code     Pri Type      State  Nr IntrName Name";
  73. PRIVATE char fmt[] = "%08LX %08LX %08LX %3d %9.9s %-6.6s %2d %-8.8s %-18.18s";
  74.  
  75. PRIVATE UBYTE tb[256] = "", *Title = &tb[0];
  76.  
  77. // --------------------------------------------------------------------
  78.  
  79. #define MAXNODES   64
  80. #define NODELENGTH 80
  81.  
  82. PRIVATE struct Node ILVNodes[ MAXNODES ] = { 0, };
  83.  
  84. PRIVATE struct List ILVList              = { 0, };
  85.  
  86. PRIVATE UBYTE       NodeStrs[ MAXNODES * NODELENGTH ] = "";
  87.  
  88. // --------------------------------------------------------------------
  89.  
  90. PRIVATE struct IntuiText SIIText[ 1 ] = {
  91.  
  92.    2, 0, JAM1, 262, 10,  NULL, (UBYTE *) "AJunk:",    NULL
  93. };
  94.  
  95. PRIVATE UWORD SIGTypes[] = {
  96.  
  97.    LISTVIEW_KIND, BUTTON_KIND, BUTTON_KIND,
  98.    BUTTON_KIND,   BUTTON_KIND, TEXT_KIND
  99. };
  100.  
  101. PRIVATE int ILVClicked(      int whichitem );
  102. PRIVATE int UpdateClicked(   int dummy     );
  103. PRIVATE int RemoveClicked(   int dummy     );
  104. PRIVATE int PriorityClicked( int dummy     );
  105. PRIVATE int CancelClicked(   int dummy     );
  106.  
  107. PRIVATE struct NewGadget SINGad[] = {
  108.  
  109.      2,  17, 627, 272,                 NULL, NULL, ILV, 0, 
  110.    NULL, (APTR) ILVClicked,
  111.    
  112.      4, 301,  71,  17, (UBYTE *) "_Update",  NULL, Update, PLACETEXT_IN, 
  113.    NULL, (APTR) UpdateClicked,
  114.    
  115.    317, 301,  72,  17, (UBYTE *) "Remove",   NULL, Remove, PLACETEXT_IN, 
  116.    NULL, (APTR) RemoveClicked,
  117.    
  118.    396, 301,  72,  17, (UBYTE *) "Priority", NULL, Priority, PLACETEXT_IN,
  119.    NULL, (APTR) PriorityClicked,
  120.    
  121.    554, 301,  72,  17, (UBYTE *) "_Cancel",  NULL, Cancel, PLACETEXT_IN,
  122.    NULL, (APTR) CancelClicked,
  123.  
  124.      2, 283, 627,  16,                 NULL, NULL, SelectTxt, NULL, 
  125.    NULL, NULL  
  126. };
  127.  
  128. PRIVATE ULONG SIGTags[] = {
  129.  
  130.    GTLV_ShowSelected, NULL, LAYOUTA_Spacing, 2, TAG_DONE,
  131.  
  132.    GT_Underscore, '_', TAG_DONE,
  133.  
  134.    GA_Disabled,  TRUE, TAG_DONE,
  135.    GA_Disabled,  TRUE, TAG_DONE,
  136.  
  137.    GT_Underscore, '_', TAG_DONE,
  138.    
  139.    GTTX_Border,  TRUE, TAG_DONE
  140. };
  141.  
  142. // --------------------------------------------------------------------
  143.  
  144. PRIVATE char mvn[80] = "";
  145.  
  146. PRIVATE char *MakeValidName( char *name, int size )
  147. {
  148.    int len = strlen( name ), i = 0;
  149.  
  150.    if (len > 80)
  151.       len = 79;
  152.       
  153.    if (len < 1)
  154.       {
  155.       strncpy( mvn, " ", size );
  156.  
  157.       mvn[ size + 1 ] = '\0';
  158.  
  159.       return( &mvn[0] );
  160.       }
  161.  
  162.    while (i < len)
  163.       {
  164.       if ((*(name + i) > 0x7E) || (*(name + i) < 0x20))
  165.          mvn[i] = ' ';
  166.       else
  167.          mvn[i] = *(name + i);
  168.           
  169.       i++;
  170.       }   
  171.  
  172.    mvn[i] = '\0';
  173.    
  174.    return( &mvn[0] );
  175. }
  176.  
  177.  
  178. PRIVATE ULONG IntrAddress = 0L;
  179. PRIVATE char  itype[12]   = "INTERRUPT";
  180.  
  181. PRIVATE char *GetIntrType( struct Node *iptr )
  182. {
  183.    switch (iptr->ln_Type)
  184.       {
  185.       case NT_INTERRUPT:  
  186.          strcpy( itype, "INTERRUPT" );
  187.          break;
  188.       
  189.       case NT_SOFTINT:
  190.          strcpy( itype, "SOFTINTRT" );
  191.          break;
  192.       
  193.       default:
  194.          strcpy( itype, "UNKNOWN  " );
  195.          break; 
  196.       }
  197.  
  198.    return( &itype[0] );
  199. }
  200.  
  201. PRIVATE char *IntrName[] = {
  202.  
  203.    "XMit Emt", "Disk Blk", "Soft Int", "I/O Port",
  204.    "Co-Proc ", "VertBeam", "Blitter ", "Aud Ch.1",
  205.    "Aud Ch.2", "Aud Ch.3", "Aud Ch.4", "ReadFull",   
  206.    "DiskSync", "External", "Mstr Enb", "NMI     "
  207. };
  208.  
  209.  
  210. PRIVATE char IntrPri[] = { 1,1,1,2,3,3,3,4,4,4,4,5,5,6,6,7 };
  211.  
  212. PRIVATE char NName[32] = "";
  213.  
  214. PRIVATE char *GetNodeName( struct Node *node )
  215. {
  216.    if (node == NULL)
  217.       strcpy( NName, "* NULL *" );
  218.  
  219.    if (node->ln_Name == NULL) 
  220.       strcpy( NName, "NO Name!" );
  221.    else 
  222.       strncpy( NName, MakeValidName( node->ln_Name, 31 ), 31 );
  223.  
  224.    return( &NName[0] );
  225. }
  226.  
  227.  
  228. PRIVATE int GetNodePri( struct Node *node )
  229. {
  230.    if (node == NULL) 
  231.       return( 0 );
  232.  
  233.    return( node->ln_Pri );
  234. }
  235.  
  236. PRIVATE int MakeIntStrings( void )
  237. {
  238.    struct Custom    *custom = (struct Custom *) 0xDFF000;
  239.    // Used only to tell if an Interrupt is enabled or not.    
  240.    
  241.    struct IntVector *iv     = NULL;
  242.    APTR              sc     = NULL;
  243.    char             *iname  = NULL;
  244.    int               i, j, rval = 0, dummy = 0;
  245.  
  246.    Forbid();
  247.       
  248.       iv = &SysBase->IntVects[0];
  249.       sc = (APTR) SysBase->IntVects[3].iv_Code;
  250.          
  251.    Permit(); // Move this later!
  252.    
  253.    for (i = 0, j = 0; i < 16; i++, iv++)
  254.       {
  255.       if ((iv != NULL) && (iv->iv_Code != NULL))
  256.          {
  257.          if (iv->iv_Code == sc) // Software Interrupt list:
  258.             {
  259.             struct List      *slist = (struct List      *) iv->iv_Data;
  260.             struct Interrupt *s     = (struct Interrupt *) slist->lh_Head;
  261.  
  262.             if (slist->lh_Head == slist->lh_Tail) // Empty list?
  263.                {
  264.                goto SkipSoftInts; // Probably will never get here.
  265.                }
  266.  
  267.             while ((s != NULL) && (j <= MAXNODES))
  268.                {
  269.                iname = GetNodeName( &(s->is_Node) );
  270.  
  271.                //"Address Data Code Pri Type State Nr IntrName Name"
  272.                sprintf( &NodeStrs[ NODELENGTH * j++ ], fmt,
  273.                         &s->is_Node,
  274.                         s->is_Data,
  275.                         s->is_Code,
  276.                         GetNodePri(  &(s->is_Node) ),
  277.                         "SOFTINTRT",
  278.                         (custom->intenar & (1 << i)) ? "Enb'd" : "Dis'd",
  279.                         IntrPri[i],
  280.                         IntrName[i],
  281.                         iname
  282.                       );
  283.  
  284.                rval++; 
  285.                
  286.                s = (struct Interrupt *) s->is_Node.ln_Succ;
  287.                }
  288.             }
  289.          else
  290.             {
  291.             iname = GetNodeName( iv->iv_Node );
  292.  
  293.             //"Address Data Code Pri Type State Nr IntrName Name"
  294.             sprintf( &NodeStrs[ NODELENGTH * j++ ], fmt,
  295.                      iv->iv_Node,
  296.                      iv->iv_Data,
  297.                      iv->iv_Code,
  298.                      GetNodePri(  iv->iv_Node ),
  299.                      GetIntrType( iv->iv_Node ),
  300.                      (custom->intenar & (1 << i)) ? "Enb'd" : "Dis'd",
  301.                      IntrPri[i],
  302.                      IntrName[i],
  303.                      iname
  304.                    );
  305.  
  306.             rval++;
  307.             } 
  308.          }
  309.  
  310. SkipSoftInts:
  311.       dummy = 0; // Hopefully, the optimizer will kill this.
  312.  
  313.       }
  314.  
  315.    return( rval );
  316. }
  317.  
  318. PRIVATE int MakeIntrList( void )
  319. {
  320.    int i = 0;
  321.    
  322.    HideListFromView( INTLVGAD, SIWnd );
  323.    
  324.    // sprintf( &NodeStrs[0], "%s", &ttl[0] ); // Column headers.
  325.  
  326.    i = MakeIntStrings();
  327.  
  328.    GT_SetGadgetAttrs( INTLVGAD, SIWnd, NULL,
  329.                       GTLV_Labels,       &ILVList,
  330.                       GTLV_Selected,     1,
  331.                       TAG_END
  332.                     );
  333.  
  334.    sprintf( Title, "%s  (# interrupts = %d):", SIWdt, i );
  335.  
  336.    SetWindowTitles( SIWnd, Title, (UBYTE *) -1 );
  337.  
  338.    return( i );
  339. }
  340.  
  341. PRIVATE int ILVClicked( int whichitem )
  342. {
  343. /*
  344.    if (whichitem == 0)
  345.       {
  346.       GT_SetGadgetAttrs( REMOVEGAD, SIWnd, NULL, 
  347.                          GA_Disabled, TRUE, TAG_DONE
  348.                        );
  349.  
  350.       GT_SetGadgetAttrs( PRIORITYGAD, SIWnd, NULL, 
  351.                          GA_Disabled, TRUE, TAG_DONE
  352.                        );
  353.  
  354.       strncpy( Title, SIWdt, 80 );
  355.       SetWindowTitles( SIWnd, Title, (UBYTE *) -1 );
  356.       }
  357.    else
  358.       {
  359. */
  360.       char bf[12];
  361.       
  362.       GT_SetGadgetAttrs( REMOVEGAD, SIWnd, NULL, 
  363.                          GA_Disabled, FALSE, TAG_DONE
  364.                        );
  365.  
  366.       GT_SetGadgetAttrs( PRIORITYGAD, SIWnd, NULL, 
  367.                          GA_Disabled, FALSE, TAG_DONE
  368.                        );
  369.       
  370.       strncpy( &bf[0], &NodeStrs[ whichitem * NODELENGTH ], 11 );
  371.       
  372.       (void) stch_l( &bf[0], (long *) &IntrAddress );
  373.  
  374.       sprintf( Title, "%s  You Selected:  0x%08LX", SIWdt, IntrAddress );
  375.  
  376.       SetWindowTitles( SIWnd, Title, (UBYTE *) -1 );
  377.  
  378.       GT_SetGadgetAttrs( TEXTGAD, SIWnd, NULL,
  379.                          GTTX_Text, &NodeStrs[ whichitem * NODELENGTH ], 
  380.                          TAG_END
  381.                        );
  382. //      }
  383.  
  384.    return( TRUE );
  385. }
  386.  
  387. PRIVATE int UpdateClicked( int dummy )
  388. {
  389.    int i;
  390.  
  391.    strcpy( Title, "Updating list..." );
  392.  
  393.    SetWindowTitles( SIWnd, Title, (UBYTE *) -1 );
  394.    
  395.    for (i = 0; i <= MAXNODES; i++)
  396.        NodeStrs[ i * NODELENGTH ] = '\0'; // Kill old ListView strings.
  397.  
  398.    (void) MakeIntrList();    // Remake ListView strings.
  399.  
  400.    GT_SetGadgetAttrs( TEXTGAD, SIWnd, NULL,
  401.                       GTTX_Text, (STRPTR) NULL, TAG_END
  402.                     );
  403.  
  404.    GT_RefreshWindow( SIWnd, NULL );
  405.  
  406.    return( (int) TRUE );
  407. }
  408.  
  409. PRIVATE int RemoveClicked( int dummy )
  410. {
  411.    sprintf( ErrMsg, "You MUST be off your medication!\n"
  412.                     "This function NOT available!" 
  413.           );
  414.  
  415.    SetReqButtons( "OKAY!" );
  416.    
  417.    (void) Handle_Problem( ErrMsg, "User Information:", NULL );
  418.       
  419.    SetReqButtons( "CONTINUE|ABORT!" );
  420.  
  421.    strncpy( Title, SIWdt, 80 );
  422.    SetWindowTitles( SIWnd, Title, (UBYTE *) -1 ); // Just in case.
  423.  
  424.    return( TRUE );
  425. }
  426.  
  427. PRIVATE int PriorityClicked( int dummy )
  428. {
  429.    sprintf( ErrMsg, "NOT implemented yet!" );
  430.  
  431.    SetReqButtons( "OKAY!" );
  432.  
  433.    (void) Handle_Problem( ErrMsg, "User Information:", NULL );
  434.  
  435.    SetReqButtons( "CONTINUE|ABORT!" );
  436.  
  437.    strncpy( Title, SIWdt, 80 );
  438.    SetWindowTitles( SIWnd, Title, (UBYTE *) -1 ); // Just in case.
  439.  
  440.    return( TRUE );
  441. }
  442.  
  443. PRIVATE void CloseSIWindow( void )
  444. {
  445.    if (SIWnd != NULL) 
  446.       {
  447.       CloseWindow( SIWnd );
  448.       SIWnd = NULL;
  449.       }
  450.  
  451.    if (SIGList != NULL) 
  452.       {
  453.       FreeGadgets( SIGList );
  454.       SIGList = NULL;
  455.       }
  456.  
  457.    if (SIFont != NULL) 
  458.       {
  459.       CloseFont( SIFont );
  460.       SIFont = NULL;
  461.       }
  462.  
  463.    return;
  464. }
  465.  
  466. PRIVATE int SICloseWindow( void )
  467. {
  468.    CloseSIWindow();
  469.    return( FALSE );
  470. }
  471.  
  472. PRIVATE int CancelClicked( int dummy )
  473. {
  474.    return( SICloseWindow() );
  475. }
  476.  
  477. // ------------------------------------------------------------------
  478.  
  479. PRIVATE void SIRender( void )
  480. {
  481.    struct IntuiText it;
  482.  
  483.    ComputeFont( Scr, Font, &CFont, SIWidth, SIHeight );
  484.  
  485.    CopyMem( (char *) &SIIText[0], (char *) &it, 
  486.             (long) sizeof( struct IntuiText )
  487.           );
  488.  
  489.    it.IText     = (UBYTE *) &ttl[0];
  490.    
  491.    it.ITextFont = Font;
  492.  
  493.    it.LeftEdge  = CFont.OffX + ComputeX( CFont.FontX, it.LeftEdge ) 
  494.                              - (IntuiTextLength( &it ) >> 1);
  495.  
  496.    it.TopEdge   = CFont.OffY + ComputeY( CFont.FontY, it.TopEdge ) 
  497.                              - (Font->ta_YSize >> 1);
  498.  
  499.    PrintIText( SIWnd->RPort, &it, 0, 0 );
  500.  
  501.    return;
  502. }
  503.  
  504. PRIVATE int OpenSIWindow( void )
  505. {
  506.    struct NewGadget    ng;
  507.    struct Gadget    *g;
  508.    UWORD        lc, tc;
  509.    UWORD        wleft = SILeft, wtop = SITop, ww, wh;
  510.  
  511.    ComputeFont( Scr, Font, &CFont, SIWidth, SIHeight );
  512.  
  513.    ww = ComputeX( CFont.FontX, SIWidth );
  514.    wh = ComputeY( CFont.FontY, SIHeight );
  515.  
  516.    if (( wleft + ww + CFont.OffX + Scr->WBorRight ) > Scr->Width ) 
  517.       wleft = Scr->Width - ww;
  518.    
  519.    if (( wtop + wh + CFont.OffY + Scr->WBorBottom ) > Scr->Height ) 
  520.       wtop = Scr->Height - wh;
  521.  
  522.    if ((SIFont = OpenDiskFont( Font )) == NULL)
  523.        return( -5 );
  524.  
  525.    if ((g = CreateContext( &SIGList )) == NULL)
  526.        return( -1 );
  527.  
  528.    for (lc = 0, tc = 0; lc < SI_CNT; lc++) 
  529.       {
  530.       CopyMem( (char *) &SINGad[ lc ], (char *) &ng, 
  531.                (long) sizeof( struct NewGadget )
  532.              );
  533.  
  534.       ng.ng_VisualInfo = VisualInfo;
  535.       ng.ng_TextAttr   = Font;
  536.  
  537.       ng.ng_LeftEdge   = CFont.OffX + ComputeX( CFont.FontX, 
  538.                                                 ng.ng_LeftEdge
  539.                                               );
  540.  
  541.       ng.ng_TopEdge    = CFont.OffY + ComputeY( CFont.FontY, 
  542.                                                 ng.ng_TopEdge
  543.                                               );
  544.  
  545.       ng.ng_Width      = ComputeX( CFont.FontX, ng.ng_Width );
  546.       ng.ng_Height     = ComputeY( CFont.FontY, ng.ng_Height);
  547.  
  548.       SIGadgets[ lc ] = g 
  549.                       = CreateGadgetA( (ULONG) SIGTypes[ lc ], 
  550.                                        g, 
  551.                                        &ng, 
  552.                                        (struct TagItem *) &SIGTags[ tc ]
  553.                                      );
  554.  
  555.       while (SIGTags[ tc ] != TAG_DONE) 
  556.          tc += 2;
  557.  
  558.       tc++;
  559.  
  560.       if (g == NULL)
  561.          return( -2 );
  562.       }
  563.  
  564.    if ((SIWnd = OpenWindowTags( NULL,
  565.  
  566.                   WA_Left,    wleft,
  567.                   WA_Top,     wtop,
  568.                   WA_Width,   ww + CFont.OffX + Scr->WBorRight,
  569.                   WA_Height,  wh + CFont.OffY + Scr->WBorBottom,
  570.       
  571.                   WA_IDCMP,   LISTVIEWIDCMP | BUTTONIDCMP 
  572.                     | IDCMP_CLOSEWINDOW | IDCMP_REFRESHWINDOW 
  573.                     | IDCMP_VANILLAKEY,
  574.       
  575.                   WA_Flags,   WFLG_DRAGBAR | WFLG_DEPTHGADGET 
  576.                     | WFLG_CLOSEGADGET | WFLG_SMART_REFRESH
  577.                     | WFLG_ACTIVATE | WFLG_RMBTRAP,
  578.       
  579.                   WA_Gadgets, SIGList,
  580.                   WA_Title,   SIWdt,
  581.                   TAG_DONE )
  582.       ) == NULL)
  583.       return( -4 );
  584.  
  585.    GT_RefreshWindow( SIWnd, NULL );
  586.  
  587.    SIRender();
  588.    
  589.    return( 0 );
  590. }
  591.  
  592. PRIVATE int SIVanillaKey( int whichkey )
  593. {
  594.    int rval = TRUE;
  595.    
  596.    switch (whichkey)
  597.       {
  598.       case 'u':
  599.       case 'U':
  600.          rval = UpdateClicked( 0 );
  601.          break;   
  602.       
  603.       case 'c':
  604.       case 'C':
  605.       case 'q':
  606.       case 'Q':
  607.          rval = CancelClicked( 0 );
  608.          break;
  609.       }
  610.       
  611.    return( rval );
  612. }
  613.  
  614. PRIVATE int HandleSIIDCMP( void )
  615. {
  616.    struct IntuiMessage *m;
  617.    int                (*func)( int );
  618.    BOOL                 running = TRUE;
  619.  
  620.    while (running == TRUE)
  621.       {
  622.       if ((m = GT_GetIMsg( SIWnd->UserPort )) == NULL) 
  623.          {
  624.          (void) Wait( 1L << SIWnd->UserPort->mp_SigBit );
  625.          continue;
  626.          }
  627.  
  628.       CopyMem( (char *) m, (char *) &SIMsg, 
  629.                (long) sizeof( struct IntuiMessage )
  630.              );
  631.  
  632.       GT_ReplyIMsg( m );
  633.  
  634.       switch (SIMsg.Class) 
  635.          {
  636.          case IDCMP_REFRESHWINDOW:
  637.             GT_BeginRefresh( SIWnd );
  638.             GT_EndRefresh( SIWnd, TRUE );
  639.             break;
  640.  
  641.          case IDCMP_CLOSEWINDOW:
  642.             running = SICloseWindow();
  643.             break;
  644.  
  645.          case IDCMP_VANILLAKEY:
  646.             running = SIVanillaKey( SIMsg.Code );
  647.             break;
  648.             
  649.          case IDCMP_GADGETUP:
  650.          case IDCMP_GADGETDOWN:
  651.             func = (void *) ((struct Gadget *) SIMsg.IAddress)->UserData;
  652.             
  653.             if (func != NULL)
  654.                running = func( SIMsg.Code );
  655.  
  656.             break;
  657.          }
  658.       }
  659.  
  660.    return( running );
  661. }
  662.  
  663. // ------------------------------------------------------------------
  664.  
  665. PUBLIC int main( void )
  666. {
  667.    int i = 0;
  668.    
  669.    if (SetupSystemList( &OpenSIWindow ) < 0)
  670.       {
  671.       fprintf( stderr, "Couldn't open a System ListViewer!\n" );
  672.       return( RETURN_FAIL );
  673.       }
  674.    
  675.    SetNotifyWindow( SIWnd );
  676.  
  677.    DisplayTitle( SIWnd, "Making Interrupt List..." );
  678.  
  679.    ILVNodes[0].ln_Succ = (struct Node *) ILVList.lh_Tail;
  680.    ILVNodes[0].ln_Pred = (struct Node *) ILVList.lh_Head;
  681.    ILVNodes[0].ln_Type = 0;
  682.    ILVNodes[0].ln_Pri  = MAXNODES - 129;
  683. //   ILVNodes[0].ln_Name = ttl;
  684.  
  685.  
  686.    for (i = 0; i <= MAXNODES; i++)
  687.       {
  688.       ILVNodes[i].ln_Name = &NodeStrs[ i * NODELENGTH ];
  689.       ILVNodes[i].ln_Pri  = MAXNODES - i - 129;
  690.       }
  691.  
  692.    NewList( (struct List *) &ILVList );      
  693.  
  694.    for (i = 0; i < MAXNODES; i++)
  695.       Enqueue( (struct List *) &ILVList, &ILVNodes[ i ] );
  696.  
  697.    (void) MakeIntrList(); // Make the list.
  698.  
  699.    ModifyListView( INTLVGAD, SIWnd, &ILVList, NULL );
  700.  
  701.    GT_SetGadgetAttrs( TEXTGAD, SIWnd, NULL,
  702.                       GTTX_Text, (STRPTR) NULL, TAG_END
  703.                     );
  704.  
  705.    GT_RefreshWindow( SIWnd, NULL );
  706.  
  707.    (void) HandleSIIDCMP();
  708.  
  709.    CloseSIWindow();         // Just in case.   
  710.  
  711.    ShutdownSystemList();
  712.  
  713.    return( RETURN_OK );
  714. }
  715.  
  716. /* ------------------ END of SysInterrupt.c file! ----------------- */
  717.